package com.ywh.train;

import java.util.MissingResourceException;
import java.util.ResourceBundle;

public class Config {
    private static final String BUNDLE_NAME = "config";
    private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME);

    public static String getProperty(String key) {
        try {
            return RESOURCE_BUNDLE.getString(key);
        } catch (MissingResourceException e) {
        }
        return "";
    }

    public static boolean isUseProxy() {
        return "true".equals(getProperty("userproxy"));
    }

    public static String getProxyIp() {
        return getProperty("ip");
    }

    public static int getProxyPort() {
        return Integer.parseInt(getProperty("port"));
    }

    public static int getSleepTime() {
        return Integer.parseInt(getProperty("sleepTime"));
    }

}
